define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.bonus/index',
        add_url: 'mall.bonus/add',
        edit_url: 'mall.bonus/edit',
        delete_url: 'mall.bonus/delete',
        export_url: 'mall.bonus/export',
        modify_url: 'mall.bonus/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                height:'full-50',
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',search: false},
                    {field: 'title', title: '红包名称'},
                    {field: 'money', minWidth: 100, title: '红包金额',search: false},
                    {field: 'maxmoney', minWidth: 100, title: '使用红包金额',search: false},
                    {field: 'starttime', minWidth: 140, title: '使用起始时间',search: false},
                    {field: 'endtime', minWidth: 140, title: '使用结束时间',search: false},
                    {field: 'getnum', minWidth: 100, title: '领取数量',search: false},
                    {field: 'usenum', minWidth: 100, title: '使用数量',search: false},
                    {field: 'status',minWidth: 80, search: 'select', selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {field: 'create_time',minWidth: 130, title: '添加时间',search: 'range'},
                    {width: 150, title: '操作', templet: ea.table.tool},
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});